<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5更新时的一个问题</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<div id="root">
    <h1>人员信息</h1>
    <button @click="updateMei">更新马冬梅的信息</button>
    <ul>
        <li v-for="(p,index) in persons" :key="p.id">
            {{p.name}}-{{p.age}}-{{p.sex}}
        </li>
    </ul>
</div>

</body>
<script type="text/javascript">
    Vue.config.productionTip=false
    //computed来实现
    const vn=new Vue({
        el:'#root',
        data:{
            persons:[
                {id:'001',name:'马冬梅',age:22,sex:'nv'},
                {id:'002',name:'周冬雨',age:14,sex:'nv'},
                {id:'003',name:'周杰伦',age:36,sex:'nan'},
                {id:'004',name:'温兆伦',age:17,sex:'nan'}
            ],
        },
        methods:{
            updateMei(){
                this.persons[0]={id:"001",name:"度数为",age: 12,sex: 'nan'}

                // this.persons[0].name='㭯老师'  奏效
                // this.persons[0].age=45  奏效
                // this.persons.sex='nan'   奏效
            }
        }
    })
</script>
</html>